{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "from pathlib import Path\n",
    "import yaml\n",
    "import collections\n",
    "from pprint import pprint\n",
    "\n",
    "from hfnet.settings import EXPER_PATH"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [],
   "source": [
    "name = 'TODO'\n",
    "with open(Path(EXPER_PATH, 'eval', name), 'r') as f:\n",
    "    raw_stats = yaml.load(f)['metrics']['all_stats']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [],
   "source": [
    "timings = collections.defaultdict(list)\n",
    "warmup = 2\n",
    "for s in raw_stats[warmup:]:\n",
    "    if s is not None:\n",
    "        for k, v in s['timings'].items():\n",
    "            timings[k].append(v)\n",
    "average = {k: (np.mean(v), np.median(v)) for k, v in timings.items()}\n",
    "print(name)\n",
    "pprint(average)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# RobotCar"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "robotcar/02-05/hf_shift-kpts_local-gpu-f32_global-np-f32_night.yaml\n",
      "{'covis': (0.01860559822582617, 0.018210291862487793),\n",
      " 'global': (0.013169680971924851, 0.013445377349853516),\n",
      " 'local': (0.005331631295564698, 0.005107879638671875),\n",
      " 'pnp': (0.17651329171366809, 0.16267991065979004)}\n"
     ]
    }
   ],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "robotcar/02-05/hf_shift-kpts_local-gpu-f32_global-np-f32_dusk.yaml\n",
      "{'covis': (0.022095190670530673, 0.020515799522399902),\n",
      " 'global': (0.01575339062739227, 0.01618969440460205),\n",
      " 'local': (0.0041552727505312125, 0.003859877586364746),\n",
      " 'pnp': (0.02495658316854703, 0.005520820617675781)}\n"
     ]
    }
   ],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "robotcar/02-05/sp+nv_shift-kpts_local-gpu-f32_global-np-f32_night.yaml\n",
      "{'covis': (0.012639381900066284, 0.008560895919799805),\n",
      " 'global': (0.013457701882211173, 0.013429522514343262),\n",
      " 'local': (0.005822661264640529, 0.00567173957824707),\n",
      " 'pnp': (0.21143789116929218, 0.20650744438171387)}\n"
     ]
    }
   ],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "robotcar/02-05/sp+nv_shift-kpts_local-gpu-f32_global-np-f32_dusk.yaml\n",
      "{'covis': (0.022481102862600553, 0.02100074291229248),\n",
      " 'global': (0.015038933996426857, 0.01377570629119873),\n",
      " 'local': (0.0037523904089200293, 0.0035392045974731445),\n",
      " 'pnp': (0.015128081733897581, 0.0044841766357421875)}\n"
     ]
    }
   ],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Aachen"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 84,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "aachen/02-05/hf_local-gpu-f32_global-np-f32_night.yaml\n",
      "{'covis': (0.06296504040559132, 0.05047762393951416),\n",
      " 'global': (0.0060204143325487776, 0.0061827898025512695),\n",
      " 'local': (0.00912059098482132, 0.009047865867614746),\n",
      " 'pnp': (0.1173677643140157, 0.10982358455657959)}\n"
     ]
    }
   ],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 100,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "aachen/02-05/sp+nv_newdb_local-gpu-f32_global-np-f32_day.yaml\n",
      "{'covis': (0.06572581758754387, 0.05311107635498047),\n",
      " 'global': (0.0071457122654230345, 0.006694316864013672),\n",
      " 'local': (0.009518497181634833, 0.009199023246765137),\n",
      " 'pnp': (0.0496542801822189, 0.0076904296875)}\n"
     ]
    }
   ],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 96,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "aachen/02-05/sp+nv_newdb_local-gpu-f32_global-np-f32_night.yaml\n",
      "{'covis': (0.0730412428577741, 0.06047165393829346),\n",
      " 'global': (0.007879391312599182, 0.007326364517211914),\n",
      " 'local': (0.009806322554747263, 0.009793996810913086),\n",
      " 'pnp': (0.08818015704552333, 0.035488009452819824)}\n"
     ]
    }
   ],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
